package day03;

public class wanke {
    public static void main(String[] args) {
        System.out.println(5%2); //1，商2余1
        System.out.println(8%2); //0，商4余0----整除
        System.out.println(2%8); //2，商0余2
        /*
        int a=5,b=5;
        a++; //相当于a=a+1
        ++b; //相当于b=b+1
        System.out.println(a); //6
        System.out.println(b); //6

  /*
        int a=5,b=5;
        a--; //相当于a=a-1
        --b; //相当于b=b-1
        System.out.println(a); //4
        System.out.println(b); //4


   */
        /*
        int a=5,b=5;
        int c = a++; //1)将a++的值5赋值给c  2)a自增1变为6
        int d = ++b; //1)将++b的值6赋值给d  2)b自增1变为6
        System.out.println(a); //6
        System.out.println(b); //6
        System.out.println(c); //5
        System.out.println(d); //6


        int a=5,b=5;
         int c = a--; //1)将a--的值5赋值给c  2)a自减1变为4
        int d = --b; //1)将--b的值4赋值为d  2)b自减1变为4
        System.out.println(a); //4
        System.out.println(b); //4
        System.out.println(c); //5
        System.out.println(d); //4

         */
        /*
        int a=5,b=10,c=5;
        boolean b1 = b>a;
        System.out.println(b1);   //true
        System.out.println(c<b);  //true
        System.out.println(a>=c); //true
        System.out.println(b<=a); //false
        System.out.println(b==c); //false
        System.out.println(a!=c); //false

        System.out.println(a+c>10); //false
        System.out.println(b%2==0); //true
        System.out.println(c++>5);  //false------c自增1变为6
        System.out.println(c++>5);  //true-------c自增1变为7
        //演示&&
        boolean b1 = b>=a && b<c;
        System.out.println(b1);          //true&&false=false
        System.out.println(b<=c && b>a); //false&&true=false
        System.out.println(a==b && c>b); //false&&false=false
        System.out.println(b!=c && a<b); //true&&true=true
//演示||
        System.out.println(b>=a || b<c); //true||false=true
        System.out.println(b<=c || b>a); //false||true=true
        System.out.println(b!=c || a<b); //true||true=true
        System.out.println(a==b || c>b); //false||false=false
//演示!
        boolean b2 = !(a<b);
        System.out.println(b2);     //!true=false
        System.out.println(!(a>b)); //!false=true

//演示&&的短路
        int a=5,b=10,c=5;
        boolean b3 = a>b && c++>2;
        System.out.println(b3); //false
        System.out.println(c);  //5，发生短路了

//演示||的短路
        boolean b4 = a<b || c++>2;
        System.out.println(b4); //true
        System.out.println(c);  //5，发生短路了
*/
        /*
        int a = 5;
        a += 10; //相当于a=(int)(a+10)
        System.out.println(a); //15
        a *= 2; //相当于a=(int)(a*2)
        System.out.println(a); //30
        a /= 6; //相当于a=(int)(a/6)
        System.out.println(a); //5

        short s = 5;
        //s = s+10; //编译错误，需强转，改为: s=(short)(s+10);
        s += 10; //相当于s=(short)(s+10)

        int age = 38;
        System.out.println("age="); //age=
        System.out.println(age);    //38
        System.out.println("age="+age); //age=38
        System.out.println("我的年龄是"+age); //我的年龄是38
        System.out.println("我今年"+age+"岁了"); //我今年38岁了

        String name = "WKJ";
        System.out.println("name="+name); //name=WKJ
        System.out.println("大家好，我叫"+name); //大家好，我叫WKJ
        System.out.println("大家好，我叫"+name+"，今年"+age+"岁了"); //大家好，我叫WKJ，今年38岁了

         //演示同化作用
        System.out.println(10+20+""+30); //3030---------String
        System.out.println(""+10+20+30); //102030-------String
        System.out.println(10+20+30+""); //60-----------String
        int num = 5;
        int flag = num>0?1:-1;
        System.out.println(flag); //1
        //满500打8折:
        double price = 300.0; //消费金额  带数(600.0,300.0)
        if(price>=500){   //满500
            price *= 0.8; //打8折
        }
        System.out.println("最终消费金额为:"+price);

//判断成绩是否合法
        int score = 555; //带数(95,-5,555)
        if(score>=0 && score<=100){
            System.out.println("成绩合法");
        }
        System.out.println("继续执行...");

*/




/*

        //满500打8折，不满500打9折:
        double price = 300.0;   //带数(600.0,300.0)
        if(price>=500){ //满
            price*=0.8;
        }else{ //不满
            price*=0.9;
        }
        System.out.println("最终消费金额为:"+price);

//判断成绩合法还是不合法
        int score = 95; //带数(95,-5,555)
        if(score>=0 && score<=100){
            System.out.println(score+"是合法成绩");
        }else{
            System.out.println(score+"是不合法成绩");
        }

        /*
        /满2000打5折，满1000不满2000打7折，满500不满1000打8折，不满500打9折:
        double price = 6000.0; //带数(2000.0,1000.0,600.0,300.0)
        if(price>=2000){
            price*=0.5;
        }else if(price>=1000){
            price*=0.7;
        }else if(price>=500){
            price*=0.8;
        }else{
            price*=0.9;
        }
        System.out.println("最终消费金额为:"+price);
*/
    }
}
